#ifndef WIDGET_H
#define WIDGET_H

#include <QMetaEnum>
#include <QTcpServer>
#include <QTcpSocket>
#include <QWidget>
#include <list>

#include "tcpserver.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class Widget;
}
QT_END_NAMESPACE

/**
 * @brief 用QTcpServer和QTcpSocket，实现tcp通信服务端
 */
class Widget : public QWidget {
  Q_OBJECT

public:
  Widget(QWidget *parent = nullptr);
  ~Widget();

public slots:
  void on_btnStart_clicked();
  void on_btnSend_clicked();
  void showMessage(const QString &info, bool conn = true);

private:
  Ui::Widget *ui;
  //  QTcpServer m_tcpServer;
  // 定义服务端对象
  TcpServer *m_tcpServer;
  bool m_start = false;
};
#endif // WIDGET_H
